disjoint set data structure

visit shbcf.ru